home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2252 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  2.4 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news text default
99% file C source text default
98% file C source, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 72 65 | 64 2e 77 65 65 67 2e 75 |Path: re|d.weeg.u|
|00000010| 69 6f 77 61 2e 65 64 75 | 21 72 6f 62 69 6e 73 6f |iowa.edu|!robinso|
|00000020| 6e 0a 46 72 6f 6d 3a 20 | 54 68 65 20 41 6d 6f 72 |n.From: |The Amor|
|00000030| 70 68 6f 75 73 20 4d 61 | 73 73 20 3c 72 6f 62 69 |phous Ma|ss <robi|
|00000040| 6e 73 6f 6e 40 62 6c 75 | 65 2e 77 65 65 67 2e 75 |nson@blu|e.weeg.u|
|00000050| 69 6f 77 61 2e 65 64 75 | 3e 0a 4e 65 77 73 67 72 |iowa.edu|>.Newsgr|
|00000060| 6f 75 70 73 3a 20 63 6f | 6d 70 2e 6c 61 6e 67 2e |oups: co|mp.lang.|
|00000070| 63 0a 53 75 62 6a 65 63 | 74 3a 20 52 65 3a 20 50 |c.Subjec|t: Re: P|
|00000080| 72 6f 62 6c 65 6d 20 77 | 69 74 68 20 63 20 63 6f |roblem w|ith c co|
|00000090| 64 65 2c 20 70 6c 65 61 | 73 65 20 68 65 6c 70 21 |de, plea|se help!|
|000000a0| 0a 44 61 74 65 3a 20 46 | 72 69 2c 20 31 39 20 4a |.Date: F|ri, 19 J|
|000000b0| 61 6e 20 31 39 39 36 20 | 32 30 3a 31 35 3a 32 38 |an 1996 |20:15:28|
|000000c0| 20 2d 30 36 30 30 0a 4f | 72 67 61 6e 69 7a 61 74 | -0600.O|rganizat|
|000000d0| 69 6f 6e 3a 20 55 6e 69 | 76 65 72 73 69 74 79 20 |ion: Uni|versity |
|000000e0| 6f 66 20 49 6f 77 61 2c | 20 49 6f 77 61 20 43 69 |of Iowa,| Iowa Ci|
|000000f0| 74 79 2c 20 49 41 2c 20 | 55 53 41 0a 44 69 73 74 |ty, IA, |USA.Dist|
|00000100| 72 69 62 75 74 69 6f 6e | 3a 20 77 6f 72 6c 64 0a |ribution|: world.|
|00000110| 4d 65 73 73 61 67 65 2d | 49 44 3a 20 3c 50 69 6e |Message-|ID: <Pin|
|00000120| 65 2e 41 33 32 2e 33 2e | 39 31 2e 39 36 30 31 31 |e.A32.3.|91.96011|
|00000130| 39 32 30 30 30 30 35 2e | 31 34 37 35 35 31 42 2d |9200005.|147551B-|
|00000140| 31 30 30 30 30 30 40 72 | 65 64 2e 77 65 65 67 2e |100000@r|ed.weeg.|
|00000150| 75 69 6f 77 61 2e 65 64 | 75 3e 0a 4e 4e 54 50 2d |uiowa.ed|u>.NNTP-|
|00000160| 50 6f 73 74 69 6e 67 2d | 48 6f 73 74 3a 20 72 65 |Posting-|Host: re|
|00000170| 64 2e 77 65 65 67 2e 75 | 69 6f 77 61 2e 65 64 75 |d.weeg.u|iowa.edu|
|00000180| 0a 4d 69 6d 65 2d 56 65 | 72 73 69 6f 6e 3a 20 31 |.Mime-Ve|rsion: 1|
|00000190| 2e 30 0a 43 6f 6e 74 65 | 6e 74 2d 54 79 70 65 3a |.0.Conte|nt-Type:|
|000001a0| 20 54 45 58 54 2f 50 4c | 41 49 4e 3b 20 63 68 61 | TEXT/PL|AIN; cha|
|000001b0| 72 73 65 74 3d 55 53 2d | 41 53 43 49 49 0a 58 2d |rset=US-|ASCII.X-|
|000001c0| 53 65 6e 64 65 72 3a 20 | 72 6f 62 69 6e 73 6f 6e |Sender: |robinson|
|000001d0| 40 72 65 64 2e 77 65 65 | 67 2e 75 69 6f 77 61 2e |@red.wee|g.uiowa.|
|000001e0| 65 64 75 0a 49 6e 2d 52 | 65 70 6c 79 2d 54 6f 3a |edu.In-R|eply-To:|
|000001f0| 20 3c 6d 69 6b 65 64 6f | 72 6d 61 6e 2d 31 39 30 | <mikedo|rman-190|
|00000200| 31 39 36 30 37 32 35 33 | 38 30 30 30 31 40 32 30 |19607253|80001@20|
|00000210| 35 2e 31 34 38 2e 32 30 | 30 2e 31 35 30 3e 20 0a |5.148.20|0.150> .|
|00000220| 0a 4f 6e 20 46 72 69 2c | 20 31 39 20 4a 61 6e 20 |.On Fri,| 19 Jan |
|00000230| 31 39 39 36 2c 20 4d 69 | 6b 65 20 44 6f 72 6d 61 |1996, Mi|ke Dorma|
|00000240| 6e 20 77 72 6f 74 65 3a | 0a 0a 3e 20 41 6c 73 6f |n wrote:|..> Also|
|00000250| 2c 20 77 68 65 6e 20 67 | 65 74 74 69 6e 67 20 73 |, when g|etting s|
|00000260| 74 72 69 6e 67 20 69 6e | 66 6f 72 6d 61 74 69 6f |tring in|formatio|
|00000270| 6e 20 66 72 6f 6d 20 74 | 68 65 20 75 73 65 72 2c |n from t|he user,|
|00000280| 20 79 6f 75 20 70 72 6f | 62 61 62 6c 79 0a 3e 20 | you pro|bably.> |
|00000290| 73 68 6f 75 6c 64 6e 27 | 74 20 75 73 65 20 61 20 |shouldn'|t use a |
|000002a0| 63 68 61 72 20 61 72 72 | 61 79 20 28 49 20 6b 6e |char arr|ay (I kn|
|000002b0| 6f 77 20 69 74 20 73 65 | 65 6d 73 20 74 6f 20 6d |ow it se|ems to m|
|000002c0| 61 6b 65 20 6d 6f 72 65 | 20 73 65 6e 73 65 20 74 |ake more| sense t|
|000002d0| 68 61 74 20 77 61 79 2c | 0a 3e 20 62 75 74 20 73 |hat way,|.> but s|
|000002e0| 6f 6f 6e 20 69 74 27 6c | 6c 20 62 65 63 6f 6d 65 |oon it'l|l become|
|000002f0| 20 63 6c 65 61 72 20 74 | 68 61 74 20 69 74 20 64 | clear t|hat it d|
|00000300| 6f 65 73 6e 27 74 29 2c | 20 62 75 74 20 79 6f 75 |oesn't),| but you|
|00000310| 20 73 68 6f 75 6c 64 20 | 75 73 65 20 61 20 73 74 | should |use a st|
|00000320| 72 69 6e 67 0a 3e 20 70 | 6f 69 6e 74 65 72 2c 20 |ring.> p|ointer, |
|00000330| 6c 69 6b 65 20 74 68 69 | 73 3a 0a 3e 20 20 20 20 |like thi|s:.> |
|00000340| 63 68 61 72 20 2a 77 6f | 72 64 3b 0a 3e 20 4e 6f |char *wo|rd;.> No|
|00000350| 77 2c 20 77 6f 72 64 20 | 69 73 20 61 20 70 6f 69 |w, word |is a poi|
|00000360| 6e 74 65 72 20 74 6f 20 | 61 20 73 74 72 69 6e 67 |nter to |a string|
|00000370| 2c 20 77 68 69 63 68 20 | 68 61 73 20 6e 6f 20 73 |, which |has no s|
|00000380| 70 65 63 69 66 69 63 20 | 6f 72 20 6c 69 6d 69 74 |pecific |or limit|
|00000390| 65 64 0a 3e 20 6c 65 6e | 67 74 68 2e 20 20 54 68 |ed.> len|gth. Th|
|000003a0| 65 6e 20 79 6f 75 20 63 | 61 6e 20 75 73 65 20 74 |en you c|an use t|
|000003b0| 68 65 20 73 74 61 6e 64 | 61 72 64 20 66 75 6e 63 |he stand|ard func|
|000003c0| 74 69 6f 6e 73 20 6c 69 | 6b 65 20 73 74 72 63 70 |tions li|ke strcp|
|000003d0| 79 20 61 6e 64 20 73 74 | 72 63 61 74 20 74 6f 0a |y and st|rcat to.|
|000003e0| 3e 20 77 6f 72 6b 20 6f | 6e 20 73 74 72 69 6e 67 |> work o|n string|
|000003f0| 20 70 6f 69 6e 74 65 72 | 73 2e 0a 0a 20 20 42 75 | pointer|s... Bu|
|00000400| 74 20 79 6f 75 20 64 6f | 20 63 65 72 74 61 69 6e |t you do| certain|
|00000410| 6c 79 20 68 61 76 65 20 | 74 6f 20 73 70 65 63 69 |ly have |to speci|
|00000420| 66 79 20 74 68 65 20 6c | 65 6e 67 74 68 21 20 20 |fy the l|ength! |
|00000430| 43 20 64 6f 65 73 6e 27 | 74 20 61 6c 6c 6f 63 61 |C doesn'|t alloca|
|00000440| 74 65 20 0a 6d 65 6d 6f | 72 79 20 66 6f 72 20 70 |te .memo|ry for p|
|00000450| 6f 69 6e 74 65 72 73 20 | 74 6f 20 70 6f 69 6e 74 |ointers |to point|
|00000460| 20 74 6f 20 61 75 74 6f | 6d 61 74 69 63 61 6c 6c | to auto|maticall|
|00000470| 79 21 0a 0a 3e 20 42 75 | 74 2c 20 69 66 20 79 6f |y!..> Bu|t, if yo|
|00000480| 75 20 64 69 64 20 69 74 | 20 77 69 74 68 20 61 20 |u did it| with a |
|00000490| 73 74 72 69 6e 67 20 70 | 6f 69 6e 74 65 72 2c 20 |string p|ointer, |
|000004a0| 69 74 27 73 20 74 68 69 | 73 20 6d 75 63 68 20 65 |it's thi|s much e|
|000004b0| 61 73 69 65 72 3a 0a 3e | 20 0a 3e 20 6d 61 69 6e |asier:.>| .> main|
|000004c0| 28 29 0a 3e 20 7b 20 0a | 3e 20 20 20 20 63 68 61 |().> { .|> cha|
|000004d0| 72 20 2a 77 6f 72 64 3b | 0a 3e 20 0a 3e 20 20 20 |r *word;|.> .> |
|000004e0| 20 70 75 74 73 28 22 45 | 6e 74 65 72 20 61 20 77 | puts("E|nter a w|
|000004f0| 6f 72 64 3a 20 22 29 3b | 0a 3e 20 20 20 20 77 68 |ord: ");|.> wh|
|00000500| 69 6c 65 28 73 63 61 6e | 66 28 22 25 73 22 2c 20 |ile(scan|f("%s", |
|00000510| 77 6f 72 64 29 20 21 3d | 20 30 29 0a 0a 20 20 4b |word) !=| 0).. K|
|00000520| 61 62 6f 6f 6d 2e 20 20 | 59 6f 75 20 68 61 76 65 |aboom. |You have|
|00000530| 6e 27 74 20 6d 61 6c 6c | 6f 63 28 29 27 64 20 61 |n't mall|oc()'d a|
|00000540| 6e 79 20 73 70 61 63 65 | 20 66 6f 72 20 77 6f 72 |ny space| for wor|
|00000550| 64 20 74 6f 20 70 6f 69 | 6e 74 20 74 6f 21 20 20 |d to poi|nt to! |
|00000560| 49 66 20 0a 74 68 69 73 | 20 63 6f 64 65 20 64 6f |If .this| code do|
|00000570| 65 73 6e 27 74 20 68 61 | 6e 67 20 6f 6e 20 6d 6f |esn't ha|ng on mo|
|00000580| 72 65 20 74 68 61 6e 20 | 61 20 66 65 77 20 63 68 |re than |a few ch|
|00000590| 61 72 61 63 74 65 72 73 | 20 6f 66 20 69 6e 70 75 |aracters| of inpu|
|000005a0| 74 20 74 68 61 6e 20 79 | 6f 75 72 20 0a 63 6f 6d |t than y|our .com|
|000005b0| 70 69 6c 65 72 20 69 73 | 20 62 65 69 6e 67 20 5f |piler is| being _|
|000005c0| 76 65 72 79 5f 20 67 65 | 6e 65 72 6f 75 73 2c 20 |very_ ge|nerous, |
|000005d0| 6f 72 20 79 6f 75 27 72 | 65 20 5f 76 65 72 79 5f |or you'r|e _very_|
|000005e0| 20 6c 75 63 6b 79 2e 20 | 20 4e 6f 74 20 6f 6e 6c | lucky. | Not onl|
|000005f0| 79 20 0a 74 68 61 74 2c | 20 62 75 74 20 61 73 73 |y .that,| but ass|
|00000600| 75 6d 69 6e 67 20 79 6f | 75 20 5f 64 69 64 5f 20 |uming yo|u _did_ |
|00000610| 61 6c 6c 6f 63 61 74 65 | 20 73 75 66 66 69 63 69 |allocate| suffici|
|00000620| 65 6e 74 20 6d 65 6d 6f | 72 79 2c 20 69 66 20 74 |ent memo|ry, if t|
|00000630| 68 65 20 75 73 65 72 20 | 65 6e 74 65 72 73 20 0a |he user |enters .|
|00000640| 22 43 6f 75 6c 64 20 73 | 6f 6d 65 62 6f 64 79 20 |"Could s|omebody |
|00000650| 70 6c 65 61 73 65 20 70 | 61 73 73 20 74 68 65 20 |please p|ass the |
|00000660| 6b 65 74 63 68 75 70 3f | 22 20 74 68 65 6e 20 79 |ketchup?|" then y|
|00000670| 6f 75 72 20 28 70 6f 6f | 72 6c 79 20 66 6f 72 6d |our (poo|rly form|
|00000680| 61 74 74 65 64 29 20 0a | 6c 6f 6f 70 20 77 69 6c |atted) .|loop wil|
|00000690| 6c 20 6f 75 74 70 75 74 | 0a 0a 59 6f 75 20 65 6e |l output|..You en|
|000006a0| 74 65 72 65 64 3a 20 43 | 6f 75 6c 64 59 6f 75 20 |tered: C|ouldYou |
|000006b0| 65 6e 74 65 72 65 64 3a | 20 73 6f 6d 65 62 6f 64 |entered:| somebod|
|000006c0| 79 59 6f 75 20 65 6e 74 | 65 72 65 64 3a 20 70 6c |yYou ent|ered: pl|
|000006d0| 65 61 73 65 20 5b 65 74 | 63 2e 5d 0a 0a 20 20 54 |ease [et|c.].. T|
|000006e0| 68 65 20 6d 6f 73 74 20 | 73 75 63 63 69 6e 63 74 |he most |succinct|
|000006f0| 20 76 65 72 73 69 6f 6e | 20 6f 66 20 74 68 65 20 | version| of the |
|00000700| 6f 72 69 67 69 6e 61 6c | 20 70 72 6f 67 72 61 6d |original| program|
|00000710| 20 69 73 0a 0a 23 69 6e | 63 6c 75 64 65 20 3c 73 | is..#in|clude <s|
|00000720| 74 64 69 6f 2e 68 3e 0a | 23 64 65 66 69 6e 65 20 |tdio.h>.|#define |
|00000730| 48 55 47 45 5f 42 55 46 | 20 31 30 32 34 20 2f 2a |HUGE_BUF| 1024 /*|
|00000740| 20 75 73 65 72 20 77 69 | 6c 6c 20 5f 6e 65 76 65 | user wi|ll _neve|
|00000750| 72 5f 20 65 6e 74 65 72 | 20 74 68 69 73 20 6d 75 |r_ enter| this mu|
|00000760| 63 68 21 20 3a 29 20 2a | 2f 0a 69 6e 74 20 6d 61 |ch! :) *|/.int ma|
|00000770| 69 6e 28 76 6f 69 64 29 | 0a 7b 0a 20 20 20 63 68 |in(void)|.{. ch|
|00000780| 61 72 20 6c 69 6e 65 5b | 48 55 47 45 5f 42 55 46 |ar line[|HUGE_BUF|
|00000790| 5d 3b 0a 20 20 20 66 67 | 65 74 73 28 6c 69 6e 65 |];. fg|ets(line|
|000007a0| 2c 20 73 69 7a 65 6f 66 | 20 6c 69 6e 65 2c 20 73 |, sizeof| line, s|
|000007b0| 74 64 69 6e 29 3b 0a 20 | 20 20 70 72 69 6e 74 66 |tdin);. | printf|
|000007c0| 28 22 59 6f 75 20 65 6e | 74 65 72 65 64 3a 20 25 |("You en|tered: %|
|000007d0| 73 22 2c 20 6c 69 6e 65 | 29 3b 0a 20 20 20 66 66 |s", line|);. ff|
|000007e0| 6c 75 73 68 28 73 74 64 | 6f 75 74 29 3b 0a 20 20 |lush(std|out);. |
|000007f0| 20 72 65 74 75 72 6e 20 | 30 3b 0a 7d 0a 0a 20 20 | return |0;.}.. |
|00000800| 54 68 69 73 20 69 73 6e | 27 74 20 70 65 72 66 65 |This isn|'t perfe|
|00000810| 63 74 20 28 69 74 20 77 | 69 6c 6c 20 6f 6e 6c 79 |ct (it w|ill only|
|00000820| 20 6f 75 74 70 75 74 20 | 74 68 65 20 66 69 72 73 | output |the firs|
|00000830| 74 20 48 55 47 45 5f 42 | 55 46 20 2d 20 31 20 0a |t HUGE_B|UF - 1 .|
|00000840| 63 68 61 72 61 63 74 65 | 72 73 20 74 68 65 20 75 |characte|rs the u|
|00000850| 73 65 72 20 65 6e 74 65 | 72 73 20 2d 2d 20 69 6e |ser ente|rs -- in|
|00000860| 63 6c 75 64 69 6e 67 20 | 74 68 65 20 74 65 72 6d |cluding |the term|
|00000870| 69 6e 61 74 69 6e 67 20 | 27 5c 6e 27 29 2c 20 62 |inating |'\n'), b|
|00000880| 75 74 20 69 74 27 73 20 | 61 20 0a 6c 6f 74 20 63 |ut it's |a .lot c|
|00000890| 6c 6f 73 65 72 2e 0a 0a | 2f 2a 2a 4a 61 6d 65 73 |loser...|/**James|
|000008a0| 20 52 6f 62 69 6e 73 6f | 6e 2a 2a 2a 2a 2a 2a 2a | Robinso|n*******|
|000008b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000008c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 0a 20 20 22 | | . "|
|000008d0| 49 66 20 61 20 66 61 74 | 61 6c 20 65 72 72 6f 72 |If a fat|al error|
|000008e0| 20 6f 63 63 75 72 73 2c | 20 74 68 65 20 70 72 6f | occurs,| the pro|
|000008f0| 67 72 61 6d 20 73 68 6f | 75 6c 64 20 6e 6f 74 20 |gram sho|uld not |
|00000900| 62 65 20 61 6c 6c 6f 77 | 65 64 20 74 6f 20 63 6f |be allow|ed to co|
|00000910| 6e 74 69 6e 75 65 2e 22 | 0a 20 2d 2d 20 4f 72 61 |ntinue."|. -- Ora|
|00000920| 63 6c 65 20 50 72 6f 2a | 43 20 55 73 65 72 27 73 |cle Pro*|C User's|
|00000930| 20 47 75 69 64 65 20 20 | 20 20 20 20 20 20 20 2a | Guide | *|
|00000940| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 6a 61 6d 65 |********|****jame|
|00000950| 73 2d 72 6f 62 69 6e 73 | 6f 6e 40 75 69 6f 77 61 |s-robins|on@uiowa|
|00000960| 2e 65 64 75 2a 2a 2f 0a | 0a 0a |.edu**/.|.. |
+--------+-------------------------+-------------------------+--------+--------+